#ifndef SMTPMAILCLIENT_H
#define SMTPMAILCLIENT_H

#include <QObject>
#include<QByteArray>
#include<QString>
#include<QTcpSocket>
#include <QProcess>
#include "localInfo.h"
const QString confFilePath = "/usr/share/kylin-service-support/kylin-service-support-key.conf";
const QString mimeTypeReturn = "<br\>";
const QString nameStr1 = "a3lsaW4tc2Vydmk=";
const QString keyStr1 = "KzFk";
using mailContent = struct mailContent{
    QString askTitle;
    QString questionDescription;
    QString customerEMail;
    QString customerTel;
    QString customerName;
    QString OSVersion;
    QString desktopVersion;
    QString systemLanguage;
    QStringList fileList;
};
Q_DECLARE_METATYPE(mailContent)
enum class SmtpErrType : int
{
    SmtpOpSucc = 0,
    SmtpConnectOverTime,
    SmtpFeedBackOverTime,
    MailServerNotReady,
    MailLoginFailed,
    SendMailConfigFeedBackOverTime,
    SmtpMailSendFailed,
    SmtpMailQuitFailed,
    SmtpLocalInfoUnready,
};

class SmtpMailClient : public QObject
{
    Q_OBJECT
public:
    explicit SmtpMailClient();
    ~SmtpMailClient();

public slots:
    void connectToHost();

    void sendMail(const mailContent& mailData);

signals:
    void hostConnectResult(int res);
    void mailSendResult(int res);
private slots:


private:
    QString m_userName;
    QString m_passWD;

    QTcpSocket * m_mailSocket = nullptr;

    mailContent m_mailStruct;

    LocalInfoStruct m_tempStruct;

    QString m_serviceKey;
    QString m_cpuInfo;
    QString m_hardDiskInfo;
    QString m_installHardDiskInfo;
    QString m_disPlayCardInfo;
    QString m_netCardInfo;
    QString m_macInfo;
    QByteArray m_lspciInfo;
    QByteArray m_dpkgInfo;

    QString decodeToOrigin(const QString& codeStr1,
                           const QString& codeStr2,
                           const QString& codeStr3);
};

#endif // SMTPMAILCLIENT_H
